/*
	jumper : Copyright 2011 Dale J Williams

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
*/
package {
	
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageDisplayState;
	import flash.display.StageQuality;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.geom.Rectangle;
	import flash.ui.Mouse;
	import flash.utils.setTimeout;
	import lads.flad.GameCore;
	import lads.jumper.JumpSceneLoader;
	
	/**
	 * ...
	 * @author Dale J Williams
	 */
	public class Main extends Sprite {
		
		private var core:GameCore;
		
		public function Main():void {
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event = null):void {
			removeEventListener(Event.ADDED_TO_STAGE, init);
			
			stage.showDefaultContextMenu = false;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;
			//stage.quality = StageQuality.MEDIUM;
			//stage.fullScreenSourceRect = new Rectangle(0, 0, 1280, 720);
			//stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
			//Mouse.hide();
			
			setTimeout(boot, 500);
		}
		
		private function boot():void {
			core = new GameCore(stage);
			var loader:JumpSceneLoader = new JumpSceneLoader();
			core.screen.addScreen(loader, true);
			loader.load();
		}
		
	}
	
}